#pragma once

#ifndef LEVEL_VOLUME_H
#define LEVEL_VOLUME_H

#include<vector>
//#include<map>
#include<AlphaTools.h>
#include"GameComponent.h"

class LevelVolume
{

private:
	LevelVolume(void){}
	LevelVolume* volume;
	

	///Simplified multimap
	vector<vector<GameComponent>>	population;
	vector<AlphaVector>		key;
public:
	
	static LevelVolume getInstance()
	{
		static bool v_flag = false;
		LevelVolume volume;
		if(!v_flag)
		{
			volume = LevelVolume();
			v_flag = true;
		}
		return volume;
	}

	~LevelVolume(void){}

	

	void broadcast(AlphaVector a, GameComponent* g)
	{
		float extractionpoint = (a.getX() * 0.00001f) + (a.getY() * 0.001f) + (a.getZ());
		//population.ext
	}

	void listen(AlphaVector a, GameComponent* g)
	{
		float insertionpoint = (a.getX() * 0.00001f) + (a.getY() * 0.001f) + (a.getZ());
		//population.insert(insertionpoint, g);
	}

	void addToMap(GameComponent g, AlphaVector a)
	{
		for(unsigned int i = 0; i < population.size(); i++)
		{
			if(a.getX() == key[i].getX())
			{
				population[i].push_back(g);
			}
			else
			{
				vector<GameComponent> t;
				t.push_back(g);
				population.push_back(t);
				key.push_back(a);
			}
		}
	}

	vector<GameComponent> extractFromMap(AlphaVector a)
	{
		vector<GameComponent> t;
		for(int i = 0; i < (int)key.size(); i++)
		{
			if(a.getX() == key[i].getX())
			{
				t = population[i];
			}
		}
		return t;
	}

};

#endif